﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BotonJXC.DAO;
using BotonJXC.Entity;

namespace BotonJXC.BLL
{
    public class AcceptanceBll : BaseBLL<AcceptanceDao, Acceptance, int>
    {
        public AcceptanceBll() { }



        /// <summary>
        /// 根据验收单编号查询验收单
        /// </summary>
        /// <param name="orderSn"></param>
        /// <returns></returns>
        public Acceptance findAcceptanceBySn(string AcceptanceSn ,string AcceptanceType)
        {

            IList<Acceptance> list = base.Dao.findOutStocksBySn(AcceptanceSn, AcceptanceType);
            if (list != null && list.Count > 0)
            {
                return list[0];
            }
            else
            {
                return null;
            }
        }
 
        public bool SaveAcceptance(Acceptance Acceptance)
        {
            try
            {
                this.Dao.SaveAcceptance(Acceptance);
                return true;
            }
            catch (Exception)
            {
                return false;
                throw;


            }

        }

        public bool Modify(Acceptance Acceptance)
        {
            try
            {
                this.Dao.Modify(Acceptance);
                return true;
            }
            catch (Exception)
            {
                return false;
                throw;


            }

        }

        public PageModel<Acceptance> FindPage(Acceptance Acceptance, DateTime? begintime, DateTime? endtime, int start, int count)
        {
            return this.Dao.FindPage(Acceptance, begintime, endtime, start, count);
        }


        public Acceptance findAcceptanceById(string orderid)
        {
            return base.Get(Int32.Parse(orderid));
        }
    }
}
